Skip to content

Fix occasional build failures with shared GitInfo.cache under parallel builds (#390)#393

Merged
kzu merged 1 commit into
mainfrom
fix/390-shared-cache
Jun 24, 2026
Merged

Fix occasional build failures with shared GitInfo.cache under parallel builds (#390)#393
kzu merged 1 commit into
mainfrom
fix/390-shared-cache

Conversation

@kzu

@kzu kzu commented Jun 24, 2026

Copy link
Copy Markdown
Member

When using a shared $(GitCachePath) (e.g. solution-level obj/) with msbuild /m,
multiple projects can race on clearing/writing GitInfo.cache, leading to
MSB3491: Could not write lines to file ... The process cannot access the file because it is being used by another process.

  • Add ContinueOnError="true" to Delete (in _GitClearCache and skip-read), MakeDir, and WriteLinesToFile (in _GitWriteCache)
    for the shared cache files (consistent with prior race fixes for IsDirty.cache and read paths, see Weird race condition with targets #321).
  • This makes the write failure non-fatal; one concurrent writer succeeds,
    values are already computed in-memory for all projects, and the up-to-date marker is updated.
  • Updated changelog.

Fixes #390

…el builds (#390)

When using a shared \ (e.g. solution-level obj/) with msbuild /m,
multiple projects can race on clearing/writing GitInfo.cache, leading to
MSB3491 'file is being used by another process'.

- Add ContinueOnError=true to Delete (clear), MakeDir, and WriteLinesToFile
  for the shared cache (consistent with prior race fixes for IsDirty.cache
  and read paths).
- This makes the write failure non-fatal; one concurrent writer succeeds,
  values are already computed in-memory for all, and the marker is updated.
- Updated changelog.

Fixes #390
@kzu kzu force-pushed the fix/390-shared-cache branch from 1630909 to c2fb8e1 Compare June 24, 2026 19:36
@kzu kzu merged commit 4f861a4 into main Jun 24, 2026
4 checks passed
@kzu kzu deleted the fix/390-shared-cache branch June 24, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build occasionally fails when using shared GitInfo.cache

1 participant